<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let arr = [10, 10, 20, 20, 30, 30, 44, 44, 55, 55]
        let newArr1 = [...new Set(arr)]
        console.log(newArr1)

        let newArr2 = Array.from(new Set(arr), val => val)
        console.log(newArr2)

        /* let newArr3 = arr.reduce((preVal, curVal, curIndex) => {
            preVal.indexOf(curVal) === -1 ? preVal.push(curVal) : preVal
            return preVal
        }, []) */
        let newArr3 = arr.reduce((preVal, curVal) => preVal.indexOf(curVal) === -1 ? [...preVal, curVal] : preVal, [])
        console.log(newArr3)


        /*  let newArr4 = arr.reduce((preVal, curVal, curIndex) => {
             preVal.includes(curVal) ? preVal : preVal.push(curVal)
             return preVal
         }, []) */
        let newArr4 = arr.reduce((preVal, curVal) => preVal.includes(curVal) ? preVal : [...preVal, curVal], [])
        console.log(newArr4)
    </script>
</body>

</html>